package com.hmall.user.service.impl;

import com.hmall.user.mapper.UserMapper;
import com.hmall.user.pojo.User;
import com.hmall.user.service.IUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserService extends ServiceImpl<UserMapper, User> implements IUserService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public int setBlance(User user) {
        User user1 = userMapper.selectById(user.getId());
       if (user1.getPassword().equals(user.getPassword())){
            return userMapper.updateBlance(user.getId(), user.getBalance());
        }else {
           return 0;
        }


    }
}